<!--
描述：选择题信息-新增组件
开发人：zyanming
开发日期：2019年9月13日
-->

<template lang="pug">
    kalix-dialog.user-add(bizKey="choice" ref="kalixBizDialog" v-bind:form-model.sync="formModel" v-bind:targetURL="targetURL")
        div.el-form(slot="dialogFormSlot")
            div.s-flex
                el-form-item.s-flex_item(label="类别" prop="type" v-bind:rules="rules.type" v-bind:label-width="labelWidth")
                    kalix-dict-select(v-model="formModel.type"  appName="enrolment" dictType="类别" )
            div.s-flex
                el-form-item.s-flex_item(label="题干" prop="stem" v-bind:rules="rules.stem" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.stem" type="textarea")
            div.s-flex
                el-form-item.s-flex_item(label="选项A" prop="answerA" v-bind:rules="rules.answerA" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.answerA")
                el-form-item.s-flex_item(label="选项B" prop="answerB" v-bind:rules="rules.answerB" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.answerB")
            div.s-flex
                el-form-item.s-flex_item(label="选项C" prop="answerC" v-bind:rules="rules.answerC" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.answerC")
                el-form-item.s-flex_item(label="选项D" prop="answerD" v-bind:rules="rules.answerD" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.answerD")
            div.s-flex
                el-form-item.s-flex_item(label="正确答案" prop="answer" v-bind:rules="rules.answer" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.answer")
            div.s-flex
                el-form-item.s-flex_item(label="试题解析" prop="analysis" v-bind:label-width="labelWidth")
                    el-input(v-model="formModel.analysis"  type="textarea")
</template>

<script type="text/ecmascript-6">
    import FormModel from './model'
    import {ChoiceURL} from '../../config.toml'

    export default {
        name: 'ChoiceAdd',
        data() {
            return {
                formModel: Object.assign({}, FormModel),
                rules: {
                    type: [{required: true, message: '请选择类别', trigger: 'change'}],
                    stem: [{required: true, message: '请输入题干', trigger: 'blur'}],
                    answerA: [{required: true, message: '请输入选项A', trigger: 'blur'}],
                    answerB: [{required: true, message: '请输入选项B', trigger: 'blur'}],
                    answerC: [{required: true, message: '请输入选项C', trigger: 'blur'}],
                    answerD: [{required: true, message: '请输入选项D', trigger: 'blur'}],
                    answer: [{required: true, message: '请输入正确答案', trigger: 'blur'}]
                },
                targetURL: ChoiceURL,
                labelWidth: '120px'
            }
        },
        components: {},
        created() {
        },
        methods: {}
    }
</script>

<style scoped lang="stylus">
    .el-form
        padding 30px 70px 30px 20px
</style>
